const Koa = require('koa')
const app = new Koa()
const KoaBody = require('koa-body')
const cors = require('koa2-cors')

const router = require('../router')

app.use(
    KoaBody({
        enableTypes: ['json', 'form', 'text'],
        multipart: true, 
        parsedMethods: ['POST', 'PUT', 'PATCH', 'DELETE'],
    })
)

app.use(cors({
    credentials: true
  }))

app.use(router.routes())

module.exports = app